
function solution(cards) {
    // Edit your code here
    let result = 0
    let len = cards.length
    for (let i = 0; i < len; i++) {
        result = result ^ cards[i]
    }
    return result
}

function main() {
    // Add your test cases here
    console.log(solution([1, 1, 2, 2, 3, 3, 4, 5, 5]) === 4);
    console.log(solution([0, 1, 0, 1, 2]) === 2);
}

main();
